import request from '@/utils/request'

// 联系消息API
export const contactMessageApi = {
  // 根据ID查询联系消息
  queryById(id) {
    return request({
      url: `/admin/contact-message/${id}`,
      method: 'GET'
    })
  },

  // 分页查询联系消息
  queryPage(pageNum, pageSize, params = {}) {
    return request({
      url: '/admin/contact-message/page',
      method: 'POST',
      params: {
        pageNum,
        pageSize
      },
      data: params
    })
  },

  // 根据条件查询联系消息列表
  queryList(params) {
    return request({
      url: '/admin/contact-message/list',
      method: 'POST',
      data: params
    })
  },

  // 创建联系消息
  create(data) {
    return request({
      url: '/admin/contact-message',
      method: 'POST',
      data
    })
  },

  // 更新联系消息
  update(id, data) {
    return request({
      url: `/admin/contact-message/${id}`,
      method: 'PUT',
      data
    })
  },

  // 删除联系消息
  delete(id) {
    return request({
      url: `/admin/contact-message/${id}`,
      method: 'DELETE'
    })
  },

  // 批量删除联系消息
  deleteBatch(ids) {
    return request({
      url: '/admin/contact-message/batch',
      method: 'DELETE',
      data: ids
    })
  },

  // 回复联系消息
  reply(id, reply) {
    return request({
      url: `/admin/contact-message/${id}/reply`,
      method: 'POST',
      data: { reply }
    })
  }
}
